дOnCteate¼򣬵õĴ뼰˵£

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  HRGN W1,W2,W3;
  int x,y,xw,yw;
  xw = Image1->Width;
  yw = Image1->Height;
  Form1->Width = xw;            //ʹСպĲ򴰿һ
  Form1->Height = yw;
  W2=CreateRectRgn(0,0,0,0);    //W2ġΪ0ʹ
  for(y=0;y<yw;y++)
  {
    for(x=0;x<xw;x++)
    {
      if(Image1->Canvas->Pixels[x][y]!=clRed)   		//Ǳɫ
      {
        W1=CreateRectRgn(x,y,x+1,y+1);          	//򴴽
        CombineRgn(W2,W2,W1,RGN_XOR);   		//W2W1ϲW2
        DeleteObject(W1);                       	//ʵW1䲻ɻȱ
      }
     }
   }
   SetWindowRgn(Handle,W2,true);                	//ڴ岢ʾ
   DeleteObject(W2);
}

